package com.stx.hotkey.common.model;

import com.stx.hotkey.common.tool.Constant;
import com.stx.hotkey.common.tool.FastJsonUtils;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;

public class MsgBuilder {
    public static ByteBuf buildByteBuf(String msg) {
        return Unpooled.copiedBuffer((msg + Constant.DELIMITER).getBytes());
    }

    public static ByteBuf buildByteBuf(HotKeyMsg hotKeyMsg) {
        return Unpooled.copiedBuffer((FastJsonUtils.convertObjectToJSON(hotKeyMsg) + Constant.DELIMITER).getBytes());
    }
}
